﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PrimeFactorsLibrary
{
   public class PrimeFactors
    {
        public string GetPrimeFactors(int number)
        {
            if (number <= 1)
                throw new ArgumentException("Number must be greater than 1.");

            StringBuilder result = new StringBuilder();
            int divisor = 2;  // 从最小的质数2开始

            while (number > 1)
            {
                while (number % divisor == 0)  // 如果能整除
                {
                    if (result.Length > 0)
                    {
                        result.Append("×");
                    }
                    result.Append(divisor);  // 将质因数添加到结果中
                    number /= divisor;  // 除以该质因数
                }
                divisor++;  // 尝试下一个数字
            }

            return result.ToString();
        }
    }
}

